package com.base.cn.platform.os.common.msg;

import com.base.cn.platform.os.common.j2cache.CustomCacheChannel;
import com.base.cn.platform.os.common.j2cache.J2CacheRegion;
import com.base.cn.platform.os.common.md5.MD5;
import com.base.cn.platform.os.common.utils.StringUtils;
import com.base.cn.platform.os.service.manage.op.affiche.OpReceiveAfficheService;

import java.util.Map;

/**
 * 消息发送工具
 *
 * @author s.li
 * @date 2019/05/30
 */
public class SendMessageUtil {

    /**
     * 发送消息
     * @param opReceiveAfficheService
     * @param customCacheChannel
     * @param dataMap
     */
    public static void sendMessage(OpReceiveAfficheService opReceiveAfficheService,
                                   CustomCacheChannel customCacheChannel,
                                   Map<String, Object> dataMap){
        String key = MD5.getMD5(System.currentTimeMillis()+ StringUtils.getRandomString(64));
        customCacheChannel.set(J2CacheRegion.ONE_HOURS_REGION.getKey(),key,dataMap);
        opReceiveAfficheService.sendMessage(key);
    }
}
